<style lang="stylus" scoped>
bgBlue = linear-gradient(to right, #04befe, #4481eb);

nav {
    width: 100%;
    height: 50px;
    background: bgBlue;


    img {
        display: inline-block;
        float: left;
        width: 25px;
        height: 25px;
        margin: 12px 10px;
    }

    p {
        display: inline-block;
        width: 80%;
        float: left;
        font-size: 18px;
        color: #ffffff;
        text-align: center;
        line-height: 50px;
    }
}
</style>
<template>
    <div>
        <nav>
          <img @click="onClose" src="../../components/imgs/icon-left.png" alt="">
          <p>刷卡返现明细</p>
        </nav>
         <i-table :columns="columns1" :data="data1"></i-table>

        <div style="width:100%;text-align:center;padding-top:2rem;">
          <Page :total="total" :page-size="pageSize" @on-change="handlePage"></Page>
        </div>
    </div>

</template>
<script>
    import axios from 'axios'
    export default {
        data () {
            return {
                pageSize:10,
                pageNumber:1,
                total:0,
                columns1: [
                    {
                        title: 'pos机名称',
                        key: 'posName'
                    },
                    {
                        title: '获得金额',
                        key: 'money'
                    },
                    {
                        title: '刷卡金额',
                        key: 'useMoney'
                    },
                    {
                        title: '操作时间',
                        key: 'time'
                    }
                ],
                data1: []
            }
        },
        mounted(){
          if(!this.$store.state.show){
            this.$router.push({path: '/repayment'});
          }
          this.getList();
        },

        methods:{
          handlePage (res){
            axios.post('/web/api/manager/yhUseCard',{"pageSize":this.pageSize,"pageNumber":res,"userId":this.$store.state.user.userId}).then(this.getListInfoSucc)
          },
          getList(){
            axios.post('web/api/manager/yhUseCard',{"pageSize":this.pageSize,"pageNumber":this.pageNumber,"userId":this.$store.state.user.userId}).then(this.getListInfoSucc)
          },
          getListInfoSucc(res){
            console.log("res=",res);
            this.data1 = res.data.date.list
            this.total = res.data.date.total
          },
          onClose(){
            this.$router.back(-1)
          }
        }
    }
</script>
